<template>
    <div id="home-slider">
        <swiper :options="swiperOption">
            <swiper-slide v-for="(item,index) in swiperData" :class="'slide'+(index+1)" :key="index">
                <div class="slide" :style="{backgroundImage: 'url(' + item.image_path + ')'}"></div>
                <div class="text-block-container">
                    <div class="text-middle mide" :class="item.middle">
                        <h2 v-if="item.intro.h2" v-html="item.intro.h2" :class="'primary-'+item.intro.color"></h2>
                        <h1 v-if="item.intro.h1" v-html="item.intro.h1" :class="'primary-'+item.intro.color"></h1>
                        <p v-if="item.intro.p" v-html="item.intro.p" :class="'primary-'+item.intro.color"></p>
                        <router-link :to="item.url" class="button" :class="item.buttonColor" v-text="item.buttonTest"></router-link>
                    </div>
                </div>
            </swiper-slide>
        </swiper>
        <div class="swiper-pagination"></div>
    </div>
</template>
<script>
import { swiper, swiperSlide } from 'vue-awesome-swiper'
export default {
    data() {
        return {
            swiperOption: { //焦点图配置
                pagination: ".swiper-pagination",
                loop: true,
                autoplay: 4000
            }
        }
    },
    props: ['swiperData'],
    components: {
        swiper,
        swiperSlide
    }
}
</script>
<style>
#home-slider .slide {
    padding-bottom: 35%;
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
}

#home-slider .slide a.full {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.text-block-container h1 {
    font-family: "Roboto Condensed", sans-serif;
    font-weight: 300;
    font-style: normal;
    color: #222;
    text-transform: uppercase;
}

.text-block-container p {
    margin-bottom: 12px;
    font-size: 13px;
    font-family: "Open Sans", sans-serif;
    font-weight: 300;
    font-style: normal;
}

.text-block-container a.button {
    display: inline-block;
    margin-top: 7px;
    font-size: 12px;
    font-family: "Roboto Condensed", sans-serif;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.text-block-container a.button.black:first-of-type {
    margin-right: 15px;
}

.text-block-container a.button.black-stroke {
    background-color: transparent;
    outline: 1px #000 solid;
    color: #222;
}

.text-block-container a.button:after {
    font-family: iconfont!important;
    content: "\e60b";
    font-weight: bold;
    font-size: 18px;
    vertical-align: middle;
    margin-left: 10px;
}

@media (max-width: 767px) {
    .text-block-container {
        margin-bottom: 20px;
    }
    .text-block-container h1 {
        font-size: 20px;
    }
    .text-block-container a.button {
        height: 30px;
        padding: 4px 15px;
        color: #fff;
        background-color: #000;
    }
    .text-block-container a.white:hover {
        background-color: #696969;
    }
    .text-block-container .mide.text-left,
    .text-block-container .mide.text-right {
        text-align: center
    }
    .text-block-container .text-middle {
        width: 80%;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    #home-slider .slide {
        height: 150px;
    }
}

@media (min-width: 768px) {
    .text-block-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    .text-block-container .text-middle {
        position: absolute;
        top: 50%;
        left: 0;
        width: 100%;
        padding-top: 25px;
        -webkit-transform: translateY(-50%);
        -moz-transform: translateY(-50%);
        -ms-transform: translateY(-50%);
        transform: translateY(-50%);
    }
    .text-block-container .mide {
        width: 80%;
        margin: 0 10%;
    }
    .text-block-container .primary-light {
        color: #fff;
    }
    .text-block-container .primary-black {
        color: #000;
    }
    .text-block-container a.button {
        height: 38px;
        padding: 8px 20px;
    }
    .text-block-container a.button.white {
        color: #222;
        background-color: #fff;
    }
    .text-block-container a.button.black {
        color: #fff;
        background-color: #000;
    }
    .text-block-container a.white:hover {
        background-color: #d9d9d9;
    }
    .text-block-container a.button.black:hover {
        background-color: #696969
    }
    .text-block-container .opy0 .primary-light {
        opacity: 0;
    }
    .text-block-container .opy0 .button {
        margin-top: 4%;
    }
}

@media (min-width: 992px) {
    .text-block-container h1 {
        font-size: 60px;
    }
}

@media (min-width: 1200px) {
    #home-slider .slide1 h2 {
        font-weight: 400;
        font-size: 52px;
    }
    #home-slider .slide1 h1 {
        font-weight: 500;
        font-size: 80px;
    }
}
</style>
